package com.cl.dao.impl;

import java.util.List;
import java.util.Map;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.cl.dao.EnterpriseAnnounceDao;
import com.cl.entity.EnterpriseAnnounce;
import com.cl.utils.DBUtils;
@Repository
public class EnterpriseAnnounceDaoImplement implements EnterpriseAnnounceDao {
	@Autowired
	private SessionFactory sf;
	@Override
	public List<Map<String, Object>>  queryEA(String sql) {
		
		return DBUtils.queryForList(sql);
	}

	@Override
	public void saveEA(EnterpriseAnnounce ea) {
		Session  s =  null;
		s= sf.openSession();
		System.out.println("author:"+ea.getPost_author());
		ea.setPost_author("");
		s.save(ea);
		s.beginTransaction().commit();
		s.close();
	}

}
